package com.qdev.apps.core.persistence.impl.type;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

/**
 * @author Vanish
 * @since 2006-03-15
 * @version $Revision: 1.3 $
 */
public class StringArrayNotNullType extends StringArrayType {

    protected String join(String[] s) {
        List pieces = Arrays.asList(s);

        StringBuffer result = new StringBuffer();
        for (Iterator iter = pieces.iterator(); iter.hasNext();) {
            String string = (String) iter.next();
            if (string != null && !string.trim().equals("")) {
                result.append(string);
                if (iter.hasNext())
                    result.append(DELIMITER);
            }
        }
        if(result.toString().equals(""))
            return null ;
        else
            return result.toString();
    }

}